<template>
  <div>
    <Modal v-model="customPop" width="50" class-name="vertical-center-modal" :mask-closable="false">
      <!-- 页头 -->
      <div slot="header" class="header-title">{{ $t('wayBill.add_service') }}</div>
      <!-- 内容-定制服务 -->
      <div class="limit-sty">
        <custom-sub-content :dataInfo="dataInfo" :isView="isView" :isRead="isRead" :isShowQcVideoCus="isShowQcVideoCus"
          @sendDataToParent="sendDataToParent" @selVidData="selVidData"></custom-sub-content>
        <Divider />
      </div>
      <!-- 底部 -->
      <div slot="footer" class="footer-wrap">
        <div class="cancel-text" @click="customPop = false">{{ $t('public.cancel') }}</div>
        <div class="submit-text" @click="referBtn">{{ $t('transport.submit') }}</div>
      </div>
    </Modal>
  </div>
</template>
<script>
import customSubContent from '../../goods/goods-details/components/custom-sub-content.vue';
export default {
  props: {
    isRead: {
      type: Boolean,
      default: false
    },
    isShowQcVideoCus: {
      type: Boolean,
      default: false
    }
  },
  components: { customSubContent },
  data() {
    return {
      customPop: false,
      dataInfo: {},
      referForm: {},
      isView: false
    }
  },
  methods: {
    open(subItem) {
      this.dataInfo = subItem;
      this.referForm.id = subItem.id;//编辑的时候传的是字段是id
      this.referForm.orderItemId = subItem.id;//订单追加增值服务的时候传的字段是orderItemId
      this.isView = subItem.notSupportQcVideos;
      this.customPop = true;
    },
    sendDataToParent(info) {
      this.referForm.services = info;
    },
    selVidData(info) {
      // 去掉空值数据
      const newArray = info.map(item => ({
        videoType: item.videoType,
        serviceType: 2
      }));
      this.referForm.videoServices = newArray;
    },
    // 关闭弹框方法
    close() {
      this.customPop = false;
    },
    // 提交数据
    referBtn() {
      this.$emit('confirmMet', this.referForm);
    }
  }
}
</script>

<style lang="less" scoped>
:deep(.ivu-modal-header) {
  border: none;
  padding: 42px 44px 38px;
}

:deep(.ivu-modal-body) {
  padding: 0 44px;
  overflow-y: scroll;
  overflow-x: hidden;
}

:deep(.ivu-modal-footer) {
  border: none;
  padding: 0 44px 25px 44px;
  text-align: left;
}

:deep(.ivu-modal-close) {
  position: absolute;
  top: 32px;
  right: 43px;
}

:deep(.ivu-modal-close .ivu-icon-ios-close) {
  color: #333333;
  font-size: 48px;
  font-weight: 600;
}

.vertical-center-modal {
  display: flex;
  align-items: center;
  justify-content: center;

  .header-title {
    font-family: Open Sans, Open Sans;
    font-weight: 600;
    font-size: 20px;
    color: #333333;
    line-height: 23px;
  }

  .limit-sty {}

  .footer-wrap {
    display: flex;
    justify-content: end;
    gap: 24px;

    .cancel-text {
      padding: 11px 40px;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid #E5E5E5;
      font-family: Open Sans, Open Sans;
      font-weight: 400;
      font-size: 18px;
      color: #AEB0B9;
      line-height: 18px;
      cursor: pointer;
    }

    .submit-text {
      padding: 11px 40px;
      background: #FF186B;
      border-radius: 8px 8px 8px 8px;
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 18px;
      color: #FFFFFF;
      line-height: 18px;
      cursor: pointer;
    }
  }
}
</style>
